using System;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.System;

/// <summary>
/// 站点配置
/// </summary>
public class SysSiteConfig : TopBasePoco, ITenant
{
    [Display(Name = "站点名称", Description = "网站的名称", GroupName = "基本信息")]
    [MaxLength(128)]
    public string Name { get; set; }

    [Display(Name = "站点Logo", Description = "网站的Logo图片", GroupName = "基本信息")]
    public FileAttachment Logo { get; set; }

    [Display(Name = "站点Logo", Description = "Logo图片的ID", GroupName = "基本信息")]
    public Guid? LogoId { get; set; }

    [Display(Name = "是否自定义部门编码", Description = "控制部门编码是否可自定义", GroupName = "编码设置")]
    public bool CustomGroupCode { get; set; }

    [Display(Name = "是否自定义岗位编码", Description = "如果开启，则岗位编码可以自定义，默认为自动生成的数字编码", GroupName = "编码设置")]
    public bool CustomJobPositionCode { get; set; }

    [Display(Name = "短信登录", Description = "是否启用短信登录功能", GroupName = "登录设置")]
    public bool SmsLogin { get; set; }

    [Display(Name = "微信登录", Description = "是否启用微信登录功能", GroupName = "登录设置")]
    public bool WechatLogin { get; set; }

    // 微信小程序相关
    [Display(Name = "微信小程序AppID", Description = "微信小程序的应用ID", GroupName = "微信配置")]
    //[JsonIgnore]
    [MaxLength(128)]
    public string WechatMpAppId { get; set; }

    [Display(Name = "微信小程序AppSecret", Description = "微信小程序的应用密钥", GroupName = "微信配置")]
    [MaxLength(128)]
    public string WechatMpAppSecret { get; set; }

    // 微信网站相关
    [Display(Name = "微信网站AppID", Description = "微信网站应用的ID", GroupName = "微信配置")]
    [MaxLength(128)]
    public string WechatWebAppId { get; set; }

    [Display(Name = "微信网站AppSecret", Description = "微信网站应用的密钥", GroupName = "微信配置")]
    [MaxLength(128)]
    public string WechatWebSecret { get; set; }

    [Display(Name = "微信网站回调地址", Description = "微信登录的回调地址", GroupName = "微信配置")]
    [MaxLength(256)]
    public string WechatWebRedirectUri { get; set; }

    // 微信APP端相关
    [Display(Name = "微信APP应用AppID", Description = "微信APP应用的应用ID", GroupName = "微信配置")]
    [MaxLength(128)]
    public string WechatAppAppId { get; set; }

    [Display(Name = "微信APP应用AppSecret", Description = "微信APP应用的密钥", GroupName = "微信配置")]
    [MaxLength(128)]
    public string WechatAppSecret { get; set; }

    [Display(Name = "微信APP回调地址", Description = "微信APP登录的回调地址", GroupName = "微信配置")]
    [MaxLength(256)]
    public string WechatAppRedirectUri { get; set; }

    // 短信相关
    [Display(Name = "短信应用ID", Description = "短信服务提供商的应用ID", GroupName = "短信配置")]
    [MaxLength(128)]
    public string SmsAppId { get; set; }

    [Display(Name = "短信服务地址", Description = "短信服务的API主机地址", GroupName = "短信配置")]
    [MaxLength(256)]
    public string SmsHost { get; set; }

    [Display(Name = "短信密钥名称", Description = "短信服务的密钥名称", GroupName = "短信配置")]
    [MaxLength(128)]
    public string SmsSecretName { get; set; }

    [Display(Name = "短信密钥", Description = "短信服务的密钥值", GroupName = "短信配置")]
    [MaxLength(128)]
    public string SmsSecretKey { get; set; }

    [Display(Name = "短信模板", Description = "短信发送时使用的模板内容", GroupName = "短信配置")]
    [MaxLength(512)]
    public string SmsTemplate { get; set; }

    // 阿里相关
    // 阿里云OCR相关：身份证验证
    [Display(Name = "阿里云OCR AppKey", Description = "阿里云OCR服务的AppKey", GroupName = "阿里云配置")]
    [MaxLength(128)]
    public string AliyunOcrAppKey { get; set; }

    [Display(Name = "阿里云OCR AppSecret", Description = "阿里云OCR服务的AppSecret", GroupName = "阿里云配置")]
    [MaxLength(128)]
    public string AliyunOcrAppSecret { get; set; }

    [Display(Name = "阿里云OCR AppCode", Description = "阿里云OCR服务的AppCode", GroupName = "阿里云配置")]
    [MaxLength(128)]
    public string AliyunOcrAppCode { get; set; }

    // 系统配置（JSON格式）
    [Display(Name = "系统配置JSON", Description = "存储海康威视、汉王等门禁打卡系统的配置信息（JSON格式）", GroupName = "JSON配置")]
    [MaxLength(2048)]
    public string ControlConfig { get; set; }

    [Display(Name = "租户代码", Description = "多租户系统中的租户唯一标识", GroupName = "系统设置")]
    [MaxLength(128)]
    public string TenantCode { get; set; }

    [Display(Name = "替换班月度限制次数", Description = "员工本月可申请替换班的最大次数,必须大于0", GroupName = "考勤设置")]
    [Required(ErrorMessage = "替换班月度限制次数不能为空")]
    [Range(1, int.MaxValue, ErrorMessage = "替换班月度限制次数必须大于0")]
    public int SubstitutionMonthlyLimit { get; set; } = 3; // 默认值为3次
}